package cn.pxxy.exception;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.servlet.ModelAndView;


@ControllerAdvice
public class CasualExceptionHandler {

    @ExceptionHandler
    public ModelAndView handleException(LoginFailureException e) {
        ModelAndView mav = new ModelAndView();
        mav.addObject("LOGIN_EXCEPTION_TYPE", e.getType());
        mav.addObject("LOGIN_EXCEPTION_MESSAGE", e.getMessage());
        mav.setViewName("error");
        return mav;
    }
}